package cn.jsprun.taglib;

import java.util.Map;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;


public class CharListParse extends TagSupport {

	private static final long serialVersionUID = 19874257349L;

	private String name;

	private String id;

	private String flag;

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	@SuppressWarnings("unchecked")
	@Override
	public int doStartTag() throws JspException {

		Map<String, String> temp = (Map) pageContext.getServletContext()
				.getAttribute("fsmap");
		String str = temp.get(name);
		String[] initcredits = str.split(flag);
		pageContext.setAttribute(this.id, initcredits);
		return super.doStartTag();
	}

}
